package enumClass;

public class enumWithInterface {
    public static void main(String[] args) {
        Direction west = Direction.WEST;
        System.out.println(west);
        System.out.println(west.getDesc());
        west.show();
    }
}

interface Info {
    void show();
}

enum Direction implements Info {
    WEST("西") {
        // 为每个枚举值提供不同的接口实现
        @Override
        public void show() {
            System.out.println("这是西方向");
        }
    },

    NORTH("北") {
        @Override
        public void show() {
            System.out.println("这是北方向");
        }
    };

    private final String desc;

    Direction(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return this.desc;
    }

    @Override
    public void show() {
        System.out.println("这是一个方向");
    }
}
